/**
 * 
 */
package coop.tecso.core.test.handlers;

import java.math.BigDecimal;
import java.util.Random;

import org.org.usurper.handlers.basic.AbstractPropertyTypeHandler;
import org.org.usurper.model.HandledBeanProperty;
import org.org.usurper.model.HandledConstructorArg;

/**
 * @author daniel
 *
 */
public class RandomBigDecimalPropertyHandler extends AbstractPropertyTypeHandler {

    private Random random;

    /**
     * 
     */
    public RandomBigDecimalPropertyHandler() {
        super(BigDecimal.class);
        random = new Random();
    }

    /*
     * (non-Javadoc)
     * @see org.org.usurper.handlers.IHandler#handle(org.org.usurper.model.HandledBeanProperty)
     */
    @Override
    public Object handle(HandledBeanProperty handledBeanProperty) {
        return doHandle();
    }

    /*
     * (non-Javadoc)
     * @see org.org.usurper.handlers.IHandler#handle(org.org.usurper.model.HandledConstructorArg)
     */
    @Override
    public Object handle(HandledConstructorArg handledConstructorArg) {
        return doHandle();
    }

    private Object doHandle() {
        return new BigDecimal(random.nextDouble());
    }

}
